/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import entity.Professor;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import manager.ProfessorManager;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 *
 * @author daz
 */
public class ShowProfessorController implements Controller {

    private ProfessorManager professorManager;

    public void setProfessorManager(ProfessorManager professorManager) {
        this.professorManager = professorManager;
    }

    public ProfessorManager getProfessorManager() {
        return professorManager;
    }

    public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
        List<Professor> listProfessors = professorManager.getListProfessors();
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("listPro", listProfessors);
        return new ModelAndView("showprofessor", "model", map);
    }
}
